<template>
	<view class="content">
		<view class="text-area">
			<text class="title">{{title}}</text>
		</view>
		<view class="text-area1">		
	     姓名：<input v-model="userform.userName" placeholder="输入您的名字">
		</view>
		<view class="text-area1">
		 密码：<input v-model="userform.userPwd" placeholder="输入您的密码">
		</view>
		<view class="text-area1">
		 手机号：<input v-model="userform.userIpone" placeholder="输入您的手机号">
		        <button type="default" style="background-color: #DD524D;" @click="iponeGetUsercode()">获取验证码</button>
		</view>
		<view class="text-area1">
		 验证码：<input v-model="userform.usercode" placeholder="输入您的验证码">
		</view>
		<view class="text-area2">
			 <button type="default" style="background-color: #DD524D;" @click="userlogin()">注册</button>
			 <text v-model="mesg"></text>
		</view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				mesg : '',
				title: '亲！注册吧',
				userform :{
					userName : '',
				    userPwd : '',
					usercode:'',
					userIpone :''
				}
			}
		},
		onLoad() {

		},
		methods: {
			iponeGetUsercode(){
				uni.request({
						url: 'http://localhost:7010/user/iponecode',
						method:'POST',
						data: {
							ipone : this.userform.ipone,
							
						},
						success: (res) => {
							console.log(res.data)
						},
						
					}) 
			},
			userlogin(){
				console.log('login')
				console.log(this.userform)
				uni.request({
					url: 'http://localhost:7010/user/add',
					method:"POST",
					header:{
						 'custom-header': 'holler:'
					},
					data: {
						userName : this.userform.userName,
						userPwd : this.userform.userPwd,
						usercode:this.userform.usercode,
						userIpone :this.userform.userIpone
						
					},
					success: (res) => {
						console.log(res.data)
					},
					
				}) 
			}
		}
	}
</script>

<style>
	.content {
		display: flex;
		flex-direction: column;
		align-items: center;
		justify-content: center;
	}

	.logo {
		height: 200rpx;
		width: 200rpx;
		margin-top: 200rpx;
		margin-left: auto;
		margin-right: auto;
		margin-bottom: 50rpx;
	}

	.text-area {
		display: flex;
		justify-content: center;
	}

	.text-area1 {
		display: flex;
		justify-content: left;
	}

	.title {
		font-size: 36rpx;
		color: #555500;
	}
</style>
